package transactions;

import util.configuration.ConfigLoader;

public abstract class AbstractTransaction {
	private long ID;
	private long timeout;
	private TransactionState state;
	
	private IResource resources[];
	
	
	private AbstractTransaction()
	{
		timeout = ConfigLoader.TransactionTimeout;
		state = TransactionState.NOT_INITIALIZED;
	}
	
	public void setID(long ID){this.ID=ID;}
	public long getID(){return ID;}
	
	
	public abstract void begin();
	public abstract void end();
	public abstract void commit();
	public abstract void abort();
	public abstract void rollback();
	public void setRequiredResource(IResource[] resources)
	{
		this.resources=resources;
	}
	public IResource[] getRequiredResource()
	{
		return this.resources;
	}
	public abstract void execute();
	
	public void setTimeout(long timeout){this.timeout = timeout;}
	public long getTimeout() {return timeout;}
}